import {useState,useEffect} from 'react'
import {getHome} from "./api/home"
// import { Carousel } from 'antd'

const Home = ()=>{
    // 用于渲染页面的home数据对象
    const [home,setHome] = useState([])
    useEffect(()=>{
        // 开启请求
        getHome().then((res)=>{
            // console.log(res)
            if (res.data.code === 1) {
                setHome(res.data.data)
            }else{
                alert("请求失败！")
            }
            console.log(home)
        })
    },[])
    return <div> 
        内容
         {/* <Carousel autoplay>
            {home.map((value,index)=>{
                return <div key={index}>
                    <img src={value} alt=""/>
                </div>
            })}
             
        </Carousel> */}

    </div>
}

export default Home